package config;/*
 *@author wenqh
 *@date 2024/4/9 10:06
 *@Description
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import java.util.Properties;

@Configuration
@ComponentScan("controller")
@EnableWebMvc//处理非bean的配置
public class SpringMVCConfig {

   /*
   @bean 获取非自定义的bean
    */
    @Bean
    public SimpleMappingExceptionResolver simpleMappingExceptionResolver(){
        SimpleMappingExceptionResolver simpleMappingExceptionResolver = new SimpleMappingExceptionResolver();
        //任何异常，统一响应
        simpleMappingExceptionResolver.setDefaultErrorView("");
        //区分异常类型，跳转不同视图
        Properties properties = new Properties();//键值对
        properties.setProperty("","");
        simpleMappingExceptionResolver.setExceptionMappings(properties);
        return simpleMappingExceptionResolver;
    }
    /*
    @EnableWebMvc
     */
}
